package com.smmisia.article.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

@Getter
public enum MessageEnum {
    READ(1, "已读"),
    UNREAD(0, "未读");

    @EnumValue
    private final int code;
    private final String desc;

    MessageEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getDesc(int code) {
        for (MessageEnum item : MessageEnum.values()) {
            if (item.getCode() == code) {
                return item.getDesc();
            }
        }
        return null;
    }
}
